package org.aphelie.chronicle.ui.editors;

import org.aphelie.chronicle.ArcSheet;
import org.aphelie.chronicle.shaper.ChronicleShaperPlugin;

public abstract class ArcSheetEditor extends ArcFormEditor {
	
	private ArcSheet sheet;
	
	public ArcSheetEditor() {
		super();
	}

	public ArcSheet getEditedSheet() {
		if (sheet == null) {
			sheet = createSheet();
		}
		return sheet;
	}
	
	private ArcSheet createSheet() {
		ArcSheet sheet = (ArcSheet) getResource().getContents().get(0);
		if (sheet.eContents().isEmpty()) {
			ChronicleShaperPlugin.shape(sheet);
		}

		/*
        Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
        if (diagnostic.getSeverity() != Diagnostic.OK) {
                resourceToDiagnosticMap.put(resource,  analyzeResourceProblems(resource, exception));
        }
        editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
        */
		return sheet;
	}

}
